Remove final remnants of 'exported' (#1146)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Mon, 25 Sep 2023 13:48:19 +0000 (07:48 -0600)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2023 13:48:19 +0000 (07:48 -0600)
* Remove final remnants of 'exported'

* incorporate review comments in duplicate filter,

and remove deleted exported keyword from unicsv doc.

---------

Co-authored-by: Robert Lipe <robertlipe@gmail.com>
duplicate.cc
geocache.h
gpx.cc
reference/duplicate_exported_1.csv [deleted file]
reference/duplicate_exported_1~csv.csv [deleted file]
reference/duplicate_exported_2.csv [deleted file]
reference/duplicate_exported_2~csv.csv [deleted file]
testo.d/duplicate.test
unicsv.cc
unicsv.h
xmldoc/formats/unicsv.xml

index dccfad8484395b6b1c897951bc4c574a84273c7f..252c068e9ebe27d9aa4374ce68c8e40286fa72f2 100644 (file)
 
 #include "duplicate.h"
 
-#include <algorithm>             // for stable_sort
-
-#include <QDateTime>             // for QDateTime
 #include <QList>                 // for QList, QList<>::iterator, QList<>::const_iterator
 #include <QMultiHash>            // for QMultiHash
+#include <QtCore>                // for qAsConst
 
 #include "defs.h"
-#include "geocache.h"            // for Geocache
-#include "src/core/datetime.h"   // for DateTime
 
 
 #if FILTERS_ENABLED
 
 #define MYNAME "duplicate"
-/*
-
-It looks odd that we have different comparisons for date and index.
-       If exported if a < b return 1
-       if index    if a < b return -1
-
-The reason is that we want to sort in reverse order by date, but forward
-order by index.  So if we have four records:
-
-    date      index
-    June 24    0
-    June 25    1
-    June 25    2
-    June 24    3
-
-we want to sort them like this:
-
-    date      index
-    June 25    1
-    June 25    2
-    June 24    0
-    June 24    3
-
-Thus, the first point we come across is the latest point, but if we
-have two points with the same export date/time, we will first see the
-one with the smaller index (i.e. the first of those two points that we
-came across while importing waypoints.)
-
-In the (common) case that we have no exported dates, the dates will all
-be zero so the sort will end up being an expensive no-op.  However, the
-complexity of this filter is dominated by other concerns.
-*/
 
 void DuplicateFilter::init()
 {
@@ -77,15 +41,8 @@ void DuplicateFilter::init()
 
 void DuplicateFilter::process()
 {
-  auto wptlist = *global_waypoint_list;
-
-  auto compare_lambda = [](const Waypoint* wa, const Waypoint* wb)->bool {
-    return wa->gc_data->exported > wb->gc_data->exported;
-  };
-  std::stable_sort(wptlist.begin(), wptlist.end(), compare_lambda);
-
   QMultiHash<QString, Waypoint*> wpthash;
-  for (Waypoint* waypointp : wptlist) {
+  for (Waypoint* waypointp : qAsConst(*global_waypoint_list)) {
 
     QString key;
     if (lcopt) {
index 25c4913191c8d4b5ed1604611899812dcc0c4394..e53cc7193efa0803bf090159d3339236b99837d3 100644 (file)
@@ -114,7 +114,6 @@ public:
   status_t is_available:2;
   status_t is_memberonly:2;
   status_t has_customcoords:2;
-  gpsbabel::DateTime exported;
   gpsbabel::DateTime last_found;
   QString placer; /* Placer name */
   int placer_id; /* Placer id */
diff --git a/gpx.cc b/gpx.cc
index cf404ed607a1c8264f3dcec2c5f5466d2842d238..9b8c8738fe1a621bca3c08d407b1e0921e39bba8 100644 (file)
--- a/gpx.cc
+++ b/gpx.cc
@@ -1080,11 +1080,6 @@ GpxFormat::fprint_xml_chain(XmlTag* tag, const Waypoint* wpt) const
       if (tag->child) {
         fprint_xml_chain(tag->child, wpt);
       }
-      if (wpt && wpt->gc_data->exported.isValid() &&
-          tag->tagname.compare(u"groundspeak:cache") == 0) {
-        writer->writeTextElement(QStringLiteral("time"),
-                                 wpt->gc_data->exported.toPrettyString());
-      }
       writer->writeEndElement();
     }
     if (!tag->parentcdata.isEmpty()) {
diff --git a/reference/duplicate_exported_1.csv b/reference/duplicate_exported_1.csv
deleted file mode 100644 (file)
index 4f41359..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-No,Latitude,Longitude,Name,Exported
-1,40.0,-105.1,"zero",2015/06/24 00:00:00
-1,40.0,-105.2,"one",2015/06/25 00:00:01
-1,40.0,-105.2,"two",2015/06/25 00:00:00
-1,40.0,-105.1,"three",2015/06/24 00:00:01
diff --git a/reference/duplicate_exported_1~csv.csv b/reference/duplicate_exported_1~csv.csv
deleted file mode 100644 (file)
index bc70f1d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-No,Latitude,Longitude,Name,Exported\r
-1,40.000000,-105.200000,"one","2015/06/25 00:00:01"\r
-2,40.000000,-105.100000,"three","2015/06/24 00:00:01"\r
diff --git a/reference/duplicate_exported_2.csv b/reference/duplicate_exported_2.csv
deleted file mode 100644 (file)
index f3f657e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-No,Latitude,Longitude,Name,Exported
-1,40.0,-105.1,"zero",2015/06/24 00:00:02
-1,40.0,-105.2,"one",2015/06/25 00:00:01
-1,40.0,-105.2,"two",2015/06/25 00:00:02
-1,40.0,-105.1,"three",2015/06/24 00:00:01
diff --git a/reference/duplicate_exported_2~csv.csv b/reference/duplicate_exported_2~csv.csv
deleted file mode 100644 (file)
index 9bd123f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-No,Latitude,Longitude,Name,Exported\r
-1,40.000000,-105.100000,"zero","2015/06/24 00:00:02"\r
-2,40.000000,-105.200000,"two","2015/06/25 00:00:02"\r
index ff8aaa5e4eceb1528ff161d9c5351e94e4696950..c6dad28aba7ef9b6e230eb3e47647760ea680a5a 100644 (file)
@@ -7,8 +7,3 @@ gpsbabel -i geo -f ${REFERENCE}/geocaching.loc -o csv -F ${TMPDIR}/filterdupe.cs
 gpsbabel -i geo -f ${REFERENCE}/geocaching.loc -f ${REFERENCE}/geocaching.loc -x duplicate,shortname \
                -o csv -F ${TMPDIR}/filterdupe.csv2
 sort_and_compare ${TMPDIR}/filterdupe.csv1 ${TMPDIR}/filterdupe.csv2
-
-gpsbabel -i unicsv,utc -f ${REFERENCE}/duplicate_exported_1.csv -x duplicate,location -o unicsv,utc -F ${TMPDIR}/duplicate_exported_1~csv.csv
-compare ${REFERENCE}/duplicate_exported_1~csv.csv ${TMPDIR}/duplicate_exported_1~csv.csv
-gpsbabel -i unicsv,utc -f ${REFERENCE}/duplicate_exported_2.csv -x duplicate,location -o unicsv,utc -F ${TMPDIR}/duplicate_exported_2~csv.csv
-compare ${REFERENCE}/duplicate_exported_2~csv.csv ${TMPDIR}/duplicate_exported_2~csv.csv
index 372fd016dd23e399a0288ee1ca862b31483ebe8f..92ca850431f7eaca1ee2afa83c8919e5062fe39e 100644 (file)
--- a/unicsv.cc
+++ b/unicsv.cc
@@ -156,7 +156,6 @@ const UnicsvFormat::field_t UnicsvFormat::fields_def[] = {
   { "diff",    fld_gc_diff, kStrAny },
   { "arch",    fld_gc_is_archived, kStrAny },
   { "avail",   fld_gc_is_available, kStrAny },
-  { "exported",        fld_gc_exported, kStrAny },
   { "found",   fld_gc_last_found, kStrAny },
   { "placer_id",       fld_gc_placer_id, kStrAny },
   { "placer",  fld_gc_placer, kStrAny },
@@ -869,7 +868,6 @@ UnicsvFormat::unicsv_parse_one_line(const QString& ibuf)
     case fld_gc_diff:
     case fld_gc_is_archived:
     case fld_gc_is_available:
-    case fld_gc_exported:
     case fld_gc_last_found:
     case fld_gc_placer:
     case fld_gc_placer_id:
@@ -907,14 +905,6 @@ UnicsvFormat::unicsv_parse_one_line(const QString& ibuf)
       case fld_gc_is_available:
         gc_data->is_available = unicsv_parse_status(value);
         break;
-      case fld_gc_exported: {
-        QTime etime;
-        QDate edate;
-        etime = unicsv_parse_time(value, edate);
-        if (edate.isValid() || etime.isValid()) {
-          gc_data->exported = unicsv_adjust_time(edate, etime, true);
-        }
-      }
       break;
       case fld_gc_last_found: {
         QTime ftime;
@@ -1251,9 +1241,6 @@ UnicsvFormat::unicsv_waypt_enum_cb(const Waypoint* wpt)
     if (gc_data->is_available != Geocache::status_t::gs_unknown) {
       unicsv_outp_flags[fld_gc_is_available] = true;
     }
-    if (gc_data->exported.isValid()) {
-      unicsv_outp_flags[fld_gc_exported] = true;
-    }
     if (gc_data->last_found.isValid()) {
       unicsv_outp_flags[fld_gc_last_found] = true;
     }
@@ -1621,13 +1608,6 @@ UnicsvFormat::unicsv_waypt_disp_cb(const Waypoint* wpt)
       *fout << unicsv_fieldsep;
     }
   }
-  if (unicsv_outp_flags[fld_gc_exported]) {
-    if (gc_data) {
-      unicsv_print_date_time(gc_data->exported);
-    } else {
-      *fout << unicsv_fieldsep;
-    }
-  }
   if (unicsv_outp_flags[fld_gc_last_found]) {
     if (gc_data) {
       unicsv_print_date_time(gc_data->last_found);
@@ -1900,9 +1880,6 @@ UnicsvFormat::write()
   if (unicsv_outp_flags[fld_gc_is_available]) {
     *fout << unicsv_fieldsep << "Available";
   }
-  if (unicsv_outp_flags[fld_gc_exported]) {
-    *fout << unicsv_fieldsep << "Exported";
-  }
   if (unicsv_outp_flags[fld_gc_last_found]) {
     *fout << unicsv_fieldsep << "Last Found";
   }
index 021e65a898893d55c9c027ce7a8658de6de54a31..a8c86664e0605bebacf192fdc618ce72177c02e5 100644 (file)
--- a/unicsv.h
+++ b/unicsv.h
@@ -133,7 +133,6 @@ private:
     fld_gc_diff,
     fld_gc_is_archived,
     fld_gc_is_available,
-    fld_gc_exported,
     fld_gc_last_found,
     fld_gc_placer,
     fld_gc_placer_id,
index bad010fdf59d9e56fb7592a3a9394af07ec90d3b..297a81a98175049aaa9eda3f94f81177d5bee721 100644 (file)
@@ -29,7 +29,6 @@
       diff =     <link linkend="style_def_geodiff">Geocache difficulty</link>
       ele =      Elevation (in meters).  For feet use "ele ft", "eleft", "ele feet", or "elefeet".
       e/w =      'e' for eastern hemisphere, 'w' for western
-      exported = Geocache export date
       found =    <link linkend="style_def_geofound">Geocache last found date</link>
       fix =      3d, 2d, etc.
       gcid =     Geocache cache id. This accepts GC-ID ("575006") and GC-Code ("GC1234G").